//package web;
//
//import top.yesjava.webfinal.common.framework.simplemvc.RequestMapping;
//import top.yesjava.webfinal.entity.User;
//import top.yesjava.webfinal.service.UserService;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//@RequestMapping("/user") // "//login.do"
//public class UserController {
////    在控制层中注入 Dao 层 ，不合理
////    负责的业务逻辑的需要用到多个表，多个操作的时候。引入服务层: 业务功能的层
//    UserService userService = new UserService();
//
//    @RequestMapping("/login.do")
//    public String login(HttpServletRequest request, HttpServletResponse response){
//        String path = null;
//        String name = request.getParameter("name");
//        String password = request.getParameter("password");
//
//        User user = userService.login(name,password);
//        boolean success = (user!=null);
//        request.getSession().setAttribute("current_user",user);
//        path = success?"main":"login";
//        if(!success){
//            request.setAttribute("msg","用户名或密码错误");
//        }
//        return  path;//视图
//    }
//
//
//
//
//
//}
